package com.ruoyi.web.controller.danger;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysDangerCheck;
import com.ruoyi.system.service.ISysDangerCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dangerCheck")
public class SysDangerCheckController extends BaseController {

    @Autowired
    private ISysDangerCheckService sysDangerCheckService;

    @PostMapping("/create")
    public AjaxResult create(@RequestBody SysDangerCheck sysDangerCheck) {
        sysDangerCheckService.create(sysDangerCheck);
        return AjaxResult.success();
    }

    @GetMapping("/list")
    public TableDataInfo list(SysDangerCheck sysDangerCheck) {
        startPage();
        List<SysDangerCheck> sysDangerCheckList = sysDangerCheckService.list(sysDangerCheck);
        return getDataTable(sysDangerCheckList);
    }

    @GetMapping("/delete")
    public AjaxResult delete(Integer id) {
        sysDangerCheckService.delete(id);
        return AjaxResult.success();
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody SysDangerCheck sysDangerCheck) {
        sysDangerCheckService.update(sysDangerCheck);
        return AjaxResult.success();
    }

    @GetMapping("/deleteFile")
    public AjaxResult deleteFile(Integer id) {
        sysDangerCheckService.deleteFile(id);
        return AjaxResult.success();
    }



}
